<template>
  <div class="prolist">
    <ul>
      <!-- <router-link :to="{ name: 'detail', params: {proid: item.proid}}" tag="li" v-for="item of prolist" :key="item.proid"> -->
      <!-- <router-link :to="'/detail/'+ item.proid" tag="li" v-for="item of prolist" :key="item.proid">
        <div class="itemimg">
           <van-image :src="item.proimg"/>
        </div>
        <div class="iteminfo">
            <p class="van-multi-ellipsis--l2">{{item.proname}}</p>
            <p class="price">¥{{item.price}}</p>
        </div>
      </router-link> -->
      <li v-for="item of prolist" :key="item.proid" @click="toDetail(item.proid)">
        <div class="itemimg">
           <van-image :src="item.proimg"/>
        </div>
        <div class="iteminfo">
            <p class="van-multi-ellipsis--l2">{{item.proname}}</p>
            <p class="price">¥{{item.price}}</p>
        </div>
      </li>
    </ul>
  </div>
</template>

<script>
export default {
  props: {
    prolist: {
      type: Array,
      required: true
    }
  },
  methods: {
    toDetail (proid) {
      // this.$router.push('/detail/' + proid)
      // this.$router.push({ path: '/detail/' + proid })
      this.$router.push({ name: 'detail', params: { proid } })
    }
  }
}
</script>

<style lang="scss" scoped>
.prolist{
  ul{
    overflow:hidden;
    li{
      width:49%;
      height:2.67rem;
      float:left;
      margin:0.5%;
      background-color:#fff;
      .itemimg{
        height: 1.67rem;
        overflow: hidden;
        .van-image{
          width: 100%;
        }
      }
      .iteminfo{
          padding:5px 8px;
          font-size: 0.12rem;
          .price{
              color: #f23030;
          }
      }
    }
  }
}
</style>
